
#include <sys/ras.h>
#include <machine/asm.h>

LEAF_ENTRY_NOPROFILE(_atomic_cas_up)
	.hidden	_C_LABEL(_atomic_cas_up)

RAS_START_ASM_HIDDEN(_atomic_cas)
	ldw	0(%arg0), %ret0
	comb,<>,n	%arg1, %ret0, 1f
	stw	%arg2, 0(%arg0)
RAS_END_ASM_HIDDEN(_atomic_cas)
1:
	bv,n	%r0(%rp)

EXIT(_atomic_cas_up)

LEAF_ENTRY_NOPROFILE(_atomic_cas_16_up)
	.hidden	_C_LABEL(_atomic_cas_16_up)

RAS_START_ASM_HIDDEN(_atomic_cas_16)
	ldh	0(%arg0),%ret0
	comb,<>,n	%arg1, %ret0, 1f
	sth	%arg2, 0(%arg0)
RAS_END_ASM_HIDDEN(_atomic_cas_16)
1:
	bv,n	%r0(%rp)
EXIT(_atomic_cas_16_up)

LEAF_ENTRY_NOPROFILE(_atomic_cas_8_up)
	.hidden	_C_LABEL(_atomic_cas_8_up)

RAS_START_ASM_HIDDEN(_atomic_cas_8)
	ldb	0(%arg0),%ret0
	comb,<>,n	%arg1, %ret0, 1f
	stb	%arg2, 0(%arg0)
RAS_END_ASM_HIDDEN(_atomic_cas_8)
1:
	bv,n	%r0(%rp)
EXIT(_atomic_cas_8_up)
